package cn.z2huo.knowledge.reference;

/**
 * <p>
 *
 * @author z2huo
 */
class ReferenceExample {

    public static void main(String[] args) {
        MyClass obj = new MyClass();
        obj.value = 10;

        System.out.println(obj.value);
        methodA(obj);
        System.out.println(obj.value);

        System.out.println();

        System.out.println(obj.value);
        methodB(obj);
        System.out.println(obj.value);
    }

    public static void methodA(MyClass obj) {
        obj.value = 20;
    }

    public static void methodB(MyClass obj) {
        obj = new MyClass();
        obj.value = 30;
        System.out.println("in method B, obj.value = " + obj.value);
    }

    static class MyClass {
        private int value;
    }

}
